Plugins
Plugins represents different extension points in Scifeon. Each plugin type serves a specific purpose, and have different capabilities. Explore the different plugins, and let us know if you need a new extension point. We will love to help.
Plugin architecture
Plugins are automatically added to Scifeon when the containing App is loaded. In general, plugins are defined using the @scifeon*
-decorators.
Plugins are automatically added to the PluginManager
, which in turn executed the match
-function defined in the @scifeon*
-decorator with a Context
-object whenever a page, panel or module queries for plugins. The Context
-object typically holds information about the current entity and associated entities.
Plugin life-cycle
As Scifeon is built on the Aurelia framework, the same life-cycle methods that are used in Aurelia, are also used Scifeon plugins.
Example: PagePlugin
The following simple PagePlugin illustrates the complete life-cycle of a plugin, from initialization to navigating away from the page again.
import { PagePlugin } from "scifeon/plugins";
@scifeonRoute({
route: "demo", // accessible on the url: https://{instance}.scifeon.cloud/#/demo
title: "Demo",
})
export class LifeCyclePage implements PagePlugin {
constructor() {
console.log("1: an instance of the plugin is created");
}
init(context) {
console.log("2: init is called with the context");
}
activate() {
console.log("3: activate is called by Aurelia");
}
created(owningView, myView) {
console.log("4: created is called by Aurelia");
}
bind(bindingContext, overrideContext) {
console.log("5: bind is called by Aurelia");
}
attached() {
console.log("6: attached is called by Aurelia - the DOM is ready");
}
detached() {
console.log("7: detached is called by Aurelia");
}
unbind() {
console.log("8: unbind is called by Aurelia");
}
}
Read more about life-cycle methods at the Aurelia documentation.